<#assign module="financial"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
</@override>
<@override name="body">
<div class="row">
	<div style="width:100%;float:left;padding-left:15px;">
	  	<div class="btn-group">
		  <a class="btn btn-default" href="${ctx}/financialrecord/list">财务明细（根据订单公司）</a>
		  <a class="btn btn-default" href="${ctx}/financialrecord/listByDriver">财务明细（根据服务人员公司）</a>
		  <a class="btn btn-default" href="${ctx}/financialrecord/driverlist">服务人员预存款</a>
		  <a class="btn btn-default" href="${ctx}/financialrecord/memberlist">客户预存款</a>
		  <a class="btn btn-default active" href="${ctx}/financialrecord/driverrechargelist">服务人员充值记录</a>
		  <a class="btn btn-default" href="${ctx}/financialrecord/memberrechargelist">客户账户明细</a>
		</div>
	</div>
</div>

<div class="row" style="margin-top:10px;">
	<div class="col-xs-10">
	  	<form class="form-inline" id="SearchForm" method="get">
	  		<@shiro.isMainCompany>
				<select class="form-control" name="companyId" id="companyId">
					<option value="">全部</option>
		  			<#list companys as company>
		  				<option value="${company.id}" <#if companyId?? && companyId==company.id>selected="selected"</#if>>${company.abbreviation}</option>
		  			</#list>
	  			</select>
			</@shiro.isMainCompany>
			
	  		<select class="form-control" name="type" id="type">
	  			<option value="">--充值方式--</option>
	  			<option value="admin_recharge" <#if type?? && type=='admin_recharge'>selected="selected"</#if>>人工充值</option>
	  			<option value="admin_consumed" <#if type?? && type=='admin_consumed'>selected="selected"</#if>>人工扣费</option>
	  			<option value="alipay" <#if type?? && type=='alipay'>selected="selected"</#if>>支付宝充值</option>
	  			<option value="weixin" <#if type?? && type=='weixin'>selected="selected"</#if>>微信充值</option>
	  			<option value="unionpay" <#if type?? && type=='unionpay'>selected="selected"</#if>>银联充值</option>
	  			<option value="order_recharge" <#if type?? && type=='order_recharge'>selected="selected"</#if>>订单提成</option>
	  			<option value="baoxiao" <#if type?? && type=='baoxiao'>selected="selected"</#if>>报销费用</option>
	  			<option value="modify_recharge" <#if type?? && type=='modify_recharge'>selected="selected"</#if>>修改订单金额</option>
	  			<option value="rebate" <#if type?? && type=='rebate'>selected="selected"</#if>>推荐提成</option>
	  			<option value="guolu" <#if type?? && type=='guolu'>selected="selected"</#if>>过路费</option>
	  			<option value="reward_recharge" <#if type?? && type=='reward_recharge'>selected="selected"</#if>>奖励金额</option>
	  			<option value="thanks" <#if type?? && type=='thanks'>selected="selected"</#if>>感谢费</option>
	  			<option value="goods" <#if type?? && type=='goods'>selected="selected"</#if>>商品费</option>
	  		</select>
	  		
	  		<div class="form-group">
	  			<input type="text" class="form-control" id="param" name="param" value="${param?if_exists}"  placeholder="输入服务人员姓名、操作人">
	  		</div>
	  		
		  	<div class="input-group">
				<input id="startTime" name="startTime" type="text" class="form-control" placeholder="开始时间" value="${startTime?if_exists}" />
			</div>
			
		  	<div class="form-group">
		  		<input id="endTime" name="endTime" type="text" class="form-control" placeholder="结束时间" value="${endTime?if_exists}" />
		    </div>
		    
		    <div class="form-group">
		        <input type="submit" class="btn btn-primary" value="查询">
		    </div>
		    
		    <div class="form-group">
		        <input type="button" id="clear_time" class="btn btn-primary" value="全部">
		    </div>
	    </form>
	</div>
	<div class="col-xs-2">
		<button class="pull-right btn btn-primary" onclick="window.location='${ctx}/financialrecord/exportDriverRechargelist?companyId=${companyId?if_exists}&param=${param?if_exists}&thisbtn=${thisbtn?if_exists}&type=${type?if_exists}&startTime=${startTime?if_exists}&endTime=${endTime?if_exists}';"><i class="glyphicon glyphicon-share-alt"></i>&nbsp;导出</button>
	</div>
</div>

<div class="row margin-top">
	<div style="float:right;margin-right:15px;">
		<#if thisbtn?? || startTime?? || endTime ?? || param?? >
		<div class="btn-group" style="margin-left:10px;">
			<p class="form-control-static"><span style="color:#394249; font-weight:700;" class="btn btn-default btn-sm">当前：${page.nowMoney}</span></p>
		</div>
		</#if>
		<div class="btn-group" style="margin-left:10px;">
			<p class="form-control-static"><a href="${ctx}/financialrecord/driverrechargelist?thisbtn=allTotal"><span  style="font-weight:700;background-color:#394249;" <#if (thisbtn)??  && thisbtn=="allTotal">class="btn btn-success btn-sm" <#else>class="btn btn-info btn-sm"</#if>>全部：${page.allTotal}</span></a></p>
		</div>
		<div class="btn-group" style="margin-left:10px;">
			<p class="form-control-static"><a href="${ctx}/financialrecord/driverrechargelist?thisbtn=thisYearTotal"><span  style="font-weight:700;background-color:#394249;" <#if (thisbtn)??  && thisbtn=="thisYearTotal">class="btn btn-success btn-sm" <#else>class="btn btn-info btn-sm"</#if>>本年：${page.thisYearTotal}</span></a></p>
		</div>
		<div class="btn-group" style="margin-left:10px;">
			<p class="form-control-static"><a href="${ctx}/financialrecord/driverrechargelist?thisbtn=thisMonthTotal"><span  style="font-weight:700;background-color:#394249;" <#if (thisbtn)??  && thisbtn=="thisMonthTotal">class="btn btn-success btn-sm" <#else>class="btn btn-info btn-sm"</#if>>本月：${page.thisMonthTotal}</span></a></p>
		</div>
		<div class="btn-group" style="margin-left:10px;">
			<p class="form-control-static"><a href="${ctx}/financialrecord/driverrechargelist?thisbtn=lastDayTotal"><span  style="font-weight:700;background-color:#394249;" <#if (thisbtn)??  && thisbtn=="lastDayTotal">class="btn btn-success btn-sm" <#else>class="btn btn-info btn-sm"</#if>>昨日：${page.lastDayTotal}</span></a></p>
		</div>
		<div class="btn-group" style="margin-left:10px;">
			<p class="form-control-static"><a href="${ctx}/financialrecord/driverrechargelist?thisbtn=thisDayTotal"><span  style="font-weight:700;background-color:#394249;" <#if (thisbtn)??  && thisbtn=="thisDayTotal">class="btn btn-success btn-sm" <#else>class="btn btn-info btn-sm"</#if>>今日：${page.thisDayTotal}</span></a></p>
		</div>
	</div>
</div>


<div class="row margin-top">
	<div class="col-xs-12">
	<div class="panel panel-primary">
	<div class="table-responsive">
		<table class="table table-hover table-striped">
			<thead>
			<tr>
				<th>服务人员姓名</th>
				<th>服务人员电话</th>
				<th>时间</th>
				<th>金额(元)</th>
				<th>操作后余额(元)</th>
				<th>方式</th>
				<th>操作人</th>
				<th>备注</th>
			</tr>
			</thead>
			<tbody>
				<#if (page.content)?? >
			  	<#list page.content as data>
					<tr>
						<td>${data.driverRealName?if_exists}</td>
						<td>${data.driverPhone?if_exists}</td>
						<td>${data.happend?string("yyyy-MM-dd HH:mm:ss")}</td>
						<td><span style="color:#ff950b;font-weight:700;">${data.money?if_exists}</span></td>
						<td><span style="color:#ff950b;font-weight:700;">${data.afterMoney?if_exists}</span></td>
						<td>
							${data.recordTypeStr?if_exists}
						</td>
						<td>${data.operating?if_exists}</td>
						<td style="max-width:450px;">${data.memo?if_exists}</td>
					</tr>
				</#list>
				</#if>
			</tbody>
		</table>
		<#if page.totalElements??>
		<ul class="pagination pull-right pagination-sm">
			<li><a>共 ${page.totalElements} 条数据</a></li>
			<@pg.pager items=page.totalElements?number maxPageItems=20 export="currentPageNumber=pageNumber" url="${ctx}/financialrecord/driverrechargelist">
				<@pg.param name="companyId" value="${companyId?if_exists}"/>
				<@pg.param name="param" value="${param?if_exists}"/>
				<@pg.param name="type" value="${type?if_exists}"/>
				<@pg.param name="startTime" value="${startTime?if_exists}"/>
				<@pg.param name="endTime" value="${endTime?if_exists}"/>
				<@pg.param name="thisbtn" value="${thisbtn?if_exists}"/>
				<@pg.index>
					<@pg.first>
						<li><a href="${pageUrl}">&laquo;</a></li>
					</@pg.first>
					<@pg.prev>
						<li><a href="${pageUrl}">&lsaquo;</a></li>
					</@pg.prev>
					<@pg.pages>
						<#if  currentPageNumber == pageNumber >
							<li class="active"><a href="#">${pageNumber}</a></li>
						<#else>
							<li><a href="${pageUrl}">${pageNumber}</a></li>
						</#if>
					</@pg.pages>
					<@pg.next>
						<li><a href="${pageUrl}">&rsaquo;</a></li>
					</@pg.next>
					<@pg.last>
						<li><a href="${pageUrl}">&raquo;</a></li>
					</@pg.last>
				</@pg.index>
			</@pg.pager>
		</ul>
		</#if>
	</div>
	</div>
	</div>
</div>

		
</@override>
<@override name="footer">
	<script type="text/javascript">
		window.daijia = {
			ctx:'${ctx}',
			userId:'<@shiro.principal property='id'/>'
		};
	</script>
	<script src="${ctx}/assets/js/pushmessage.js"></script>
	<script src="${ctx}/assets/js/bootstrap-datetimepicker.min.js"></script>
	<script src="${ctx}/assets/js/bootstrap-datetimepicker.zh-CN.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
		
		   	$("#startTime").datetimepicker({
		        format: "yyyy-mm-dd HH:ii",
		        language: 'zh-CN',
		        showMeridian: true,
		        autoclose: true,
		        todayBtn: true
		    });
			$("#endTime").datetimepicker({
				format: "yyyy-mm-dd HH:ii",
		        language: 'zh-CN',
		        showMeridian: true,
		        autoclose: true,
		        todayBtn: true
		    });
			
			$("#clear_time").click(function(){
				$("#companyId").val("");
				$("#type").val("");
				$("#param").val("");
				$("#startTime").val("");
				$("#endTime").val("");
				$("#SearchForm").submit();
			});
		});
		$(".btn-info").mouseover(function(){
	    	if($(this).hasClass("btn-info")){
	    		$(this).removeClass("btn-info").addClass("btn-success");
	    	}
    	 });
		$(".btn-info").mouseout(function(){
	    		$(this).removeClass("btn-success").addClass("btn-info");
    	 });
    	 $('#endTime').change(function(){
			  var begin=new Date($('#startTime').val().replace(/-/g,"/"));
		      var end=new Date($('#endTime').val().replace(/-/g,"/"));
		   	   if(begin!=null&&end!=null&&begin-end>=0){
	  				 $('#endTime').val("");
	  				 $.scojs_message("截止日期要在开始日期之后!", $.scojs_message.TYPE_ERROR);
		      	}
		 });
		  $('#startTime').change(function(){
			  var begin=new Date($('#startTime').val().replace(/-/g,"/"));
		      var end=new Date($('#endTime').val().replace(/-/g,"/"));
		   	   if(begin!=null&&end!=null&&begin-end>=0){
	  				 $('#endTime').val("");
	  				 $.scojs_message("开始日期要在截止日期之前!", $.scojs_message.TYPE_ERROR);
		      	}
		 });
	</script>
</@override>
<@extends name="../layout.ftl"/>